# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=mediastreamer2
pkgver=5.3.41
pkgrel=0
pkgdesc="library written in C that allows you to create and run audio and video streams"
url="https://www.linphone.org/technical-corner/mediastreamer2"
arch="all"
license="GPL-2.0-or-later"
options="!check" # no test available
makedepends="
	alsa-lib-dev
	bcg729-dev
	bctoolbox-dev
	bzrtp-dev
	cmake
	doxygen
	ffmpeg4-dev
	gettext-dev
	glew-dev
	graphviz
	grep
	gsm-dev
	jpeg-dev
	libpcap-dev
	libsrtp-dev
	libtheora-dev
	libvpx-dev
	libxml2-dev
	libxv-dev
	mesa-dev
	opus-dev
	ortp-dev
	python3-dev
	samurai
	spandsp-dev
	speex-dev
	speexdsp-dev
	sqlite-dev
	tiff-dev
	v4l-utils-dev
	"
subpackages="$pkgname-dev $pkgname-doc"
source="https://gitlab.linphone.org/BC/public/mediastreamer2/-/archive/$pkgver/mediastreamer2-$pkgver.tar.gz
	fix-cmake-path.patch
	fix-soname.patch
	"

build() {
	cmake -G Ninja -B build \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_MODULE_PATH=/usr/lib/cmake \
		-DCMAKE_SKIP_INSTALL_RPATH=ON \
		-DENABLE_STRICT=NO \
		-DENABLE_ALSA=YES \
		-DENABLE_STATIC=NO \
		-DENABLE_RESAMPLE=YES \
		-DENABLE_JPEG=YES \
		-DENABLE_PCAP=YES \
		-DENABLE_FFMPEG=YES \
		-DENABLE_SPEEX_CODEC=YES \
		-DENABLE_SPEEX_DSP=YES \
		-DBUILD_SHARED_LIBS=YES \
		-DENABLE_VPX=YES \
		-DENABLE_UNIT_TESTS=NO
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
	rm -r "$pkgdir"/usr/include/OpenGL
}

sha512sums="
ee38aeb0a5c825b791240d6388789e58c170592946d8c33c2f7807adb350a996544540153b3d373193fdb3d63773fd6dd45f4c06881ff7016da202c4cf8bb3ec  mediastreamer2-5.3.41.tar.gz
964467b5f493915d4e920b3afce9ce0cacc9bb34a7886c4b4e06340d6fa646754a03ce18ec66a4a3b82d63ec52330a0b21c842d80e47a6685eb942bb01b1869b  fix-cmake-path.patch
9aa98303d53c622cd8ee6386544db337eb5069d86754876d6901a0d9bebe6e6d623f41c7ae900bb2649254b503ee63367ce612bc4bec9423fc3d57cfece119c2  fix-soname.patch
"
